<include file="__PUBLIC__/header"/>
<script src="__STATIC__/Uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="__STATIC__/Uploadify/uploadify.css">

<div class="page-container">
    <div id="tab-system" class="HuiTab">
        <div class="tabBar cl">
            <span >基本设置</span>
            <span >高级选项</span>
            <span >栏目内容</span>
        </div>
            <div class="tabCon">
                <table class="table table-border table-bordered table-bg mt-20 table-sort">
                    <tr>
                        <th width="100">绑定模型</th>
                        <td>
                            <select name="mid" class="select">
                                <list from="$model" name="$m">
                                    <if value="$m.enable">
                                        <option value="{$m.mid}">
                                            {$m.model_name}
                                        </option>
                                    </if>
                                </list>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>上级栏目</th>
                        <td>
                            <select name="pid" class="select">
                                <option value="0">一级栏目</option>
                                <list from="$category" name="$c">
                                    <option value="{$c.cid}"
                                    <if value="$hd.get.pid==$c.cid">selected='selected'</if>
                                    >{$c._name}</option>
                                </list>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>栏目名称</th>
                        <td>
                            <input type="text" name="catname" required="" class="input-text"/>
                        </td>
                    </tr>
                    <tr>
                        <th>栏目类型</th>
                        <td>
                            <label><input type="radio" name="cattype" checked="checked" value="1"/> 列表页 (允许在本栏目发布文档，并生成文档列表）</label>
                            <label><input type="radio" name="cattype" value="2"/> 频道封面 (栏目本身不允许发布文档）</label>
                            <label><input type="radio" name="cattype" value="3"/> 外部链接(在跳转Url处填写网址)

                            </label>
                            <label><input type="radio" name="cattype" value="4"/> 单页面(直接发布文章，如:公司简介)</label>
                        </td>
                    </tr>
                    <tr>
                        <th>保存目录</th>
                        <td>
                            <input type="text" name="catdir" required="" class="input-text"/>
                        </td>
                    </tr>
                    <tr>
                        <th>跳转Url</th>
                        <td>
                            <input type="text" name="cat_redirecturl" class="input-text"/>
                            <span class="hd-validate-notice">栏目类型选择为“外部链接”才有效</span>
                        </td>
                    </tr>
                    <tr>
                        <th>栏目图片</th>
                        <td>
                            <input type="text" name="catimage" class="input-text" readonly=""/>
                            <input id="file" type="file" multiple="true">
                            <img id="catimage" style="display: none;"/>
                            <script type="text/javascript">
                                $(function() {
                                    $('#file').uploadify({
                                        'formData'     : {//POST数据
                                            '<?php echo session_name();?>' : '<?php echo session_id();?>',
                                        },
                                        'fileTypeDesc' : '栏目图片',//上传描述
                                        'fileTypeExts' : '*.gif; *.jpg; *.png',
                                        'swf'      : '__STATIC__/Uploadify/uploadify.swf',
                                        'uploader' : '{|U:"categoryImage"}',
                                        'buttonText':'上传图片',
                                        'fileSizeLimit' : '1000KB',
                                        'uploadLimit' : 100,//上传文件数
                                        'width':65,
                                        'height':25,
                                        'successTimeout':10,//等待服务器响应时间
                                        'removeTimeout' : 0.5,//成功显示时间
                                        'onUploadSuccess' : function(file, data, response) {
                                            data=$.parseJSON(data);
                                            $("[name='catimage']").val(data.path);
                                            $("#catimage").attr('src',data.url).show();

                                        }
                                    });
                                });
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <th>栏目访问</th>
                        <td>
                            <label><input type="radio" name="cat_url_type" value="1"/> 静态</label>
                            <label><input type="radio" name="cat_url_type" value="2" checked="checked"/> 动态</label>
                        </td>
                    </tr>
                    <tr>
                        <th>文章访问</th>
                        <td>
                            <label><input type="radio" name="arc_url_type" value="1"/> 静态</label>
                            <label><input type="radio" name="arc_url_type" value="2" checked="checked"/> 动态</label>
                        </td>
                    </tr>
                    <tr>
                        <th>在导航显示</th>
                        <td>
                            <label><input type="radio" name="cat_show" value="1" checked="checked"/> 是</label>
                            <label><input type="radio" name="cat_show" value="0"/> 否</label>
                            <span class="hd-validate-notice">前台使用&lt;channel&gt;标签时是否显示</span>
                        </td>
                    </tr>
                </table>
            </div>
        <div class="tabCon">
            <table class="table table-border table-bordered table-bg mt-20 table-sort">
                <tr>
                    <th width="150">封面模板</th>
                    <td>
                        <input type="text" name="index_tpl" required="" id="index_tpl" class="input-text" value="article_index.html"/>
                    </td>
                </tr>
                <tr>
                    <th>列表页模板</th>
                    <td>
                        <input type="text" name="list_tpl" required="" id="list_tpl" class="input-text" value="article_list.html"/>
                    </td>
                </tr>
                <tr>
                    <th>内容页模板</th>
                    <td>
                        <input type="text" name="arc_tpl" required="" id="arc_tpl" class="input-text" value="article_default.html"/>
                    </td>
                </tr>
                <tr>
                    <th>栏目页URL规则</th>
                    <td>
                        <input type="text" name="cat_html_url" required="" class="input-text" value="{catdir}/{page}.html"/>
                        <span class="hd-validate-notice">{cid} 栏目ID, {catdir} 栏目目录, {page} 列表的页码</span>
                    </td>
                </tr>
                <tr>
                    <th>内容页URL规则</th>
                    <td>
                        <input type="text" name="arc_html_url" required="" class="input-text" value="{catdir}/{y}/{m}{d}/{aid}.html"/>
                        <span class="hd-validate-notice">{y}、{m}、{d} 年月日,{timestamp}UNIX时间戳 {catdir}栏目目录 {cid}栏目cid {aid}文章ID</span>
                    </td>
                </tr>
            </table>
        </div>

        <div class="tabCon">
            <table class="table table-border table-bordered table-bg mt-20 table-sort">
                <tr>
                    <th width="150">关键字</th>
                    <td>
                        <input type="text" name="cat_keyworks" class="input-text"/>
                    </td>
                </tr>
                <tr>
                    <th>描述</th>
                    <td>
                        <textarea name="cat_description" class="textarea"></textarea>
                    </td>
                </tr>
                <tr>
                    <th>SEO标题</th>
                    <td>
                        <input type="text" name="cat_seo_title" class="input-text"/>
                    </td>
                </tr>
                <tr>
                    <th>SEO描述</th>
                    <td>
                        <textarea name="cat_seo_description" class="textarea"></textarea>
                    </td>
                </tr>
                <tr>
                    <th>
                        投稿不需要审核
                    </th>
                    <td>
                        <label><input type="radio" name="member_send_status" value="1" checked=""/> 是 </label>
                        <label><input type="radio" name="member_send_status" value="0"/> 否 </label>
                    </td>
                </tr>
                <tr>
                    <th>应用到子栏目</th>
                    <td>
                        <label><input type="radio" name="priv_child" value="1"/> 是 </label>
                        <label><input type="radio" name="priv_child" value="0" checked=""/> 否 </label>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <br/>
    <div class="row cl">
        <div class="col-xs-8 col-sm-9">
            <button type="submit" class="btn btn-primary radius"><i class="iconfont icon-duigou1"></i>&nbsp;确定&nbsp;</button>
        </div>
    </div>
    </form>
</div>
<include file="__PUBLIC__/footer"/>
<script>
    $(function(){
        $.Huitab("#tab-system .tabBar span","#tab-system .tabCon","current","click","0");
        //表单提交
        $("#form").Validform({
            tiptype:2,
            ajaxPost:true,
            showAllError:true,
            callback:function(ret){
                ajax_progress(ret);
            }
        });
    });

    //获得静态目录(将目录名转为拼音)
    $("[name='catname']").blur(function () {
        //栏目名
        $catname = $.trim($("[name='catname']").val())
        //静态目录名
        $catdir = $.trim($("[name='catdir']").val());
        //静态目录名为空时获得
        if (!$catdir && $catname) {
            var pid = $("[name=pid]").val();
            $.post(CONTROLLER + "&a=dir_to_pinyin&pid=" + pid, {catname: $(this).val()}, function (data) {
                $("[name='catdir']").val(data);
            })
        }
    })
</script>
</body>
</html>